home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
himetr1r
/
ctlcolou.ctl
< prev
next >
Wrap
Text File
|
1999-08-14
|
32KB
|
917 lines
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.UserControl ctlColour
ClientHeight = 1485
ClientLeft = 0
ClientTop = 0
ClientWidth = 1860
ScaleHeight = 1485
ScaleWidth = 1860
Begin RichTextLib.RichTextBox rtfMain
Height = 1455
Left = 0
TabIndex = 1
Top = 0
Width = 1815
_ExtentX = 3201
_ExtentY = 2566
_Version = 393217
ScrollBars = 3
TextRTF = $"ctlColour.ctx":0000
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Courier New"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin RichTextLib.RichTextBox rtfTemp
Height = 855
Left = 2400
TabIndex = 0
Top = 1320
Visible = 0 'False
Width = 975
_ExtentX = 1720
_ExtentY = 1508
_Version = 393217
ScrollBars = 3
TextRTF = $"ctlColour.ctx":00C8
End
End
Attribute VB_Name = "ctlColour"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'----------------------------------------
'- Name: Sam Huggill
'- Email: sam@vbsquare.com
'- Web: http://www.vbsquare.com/
'- Company: Lighthouse Internet Solutions
'- Date/Time: 14/08/99 11:26:38
'----------------------------------------
'- Notes: Automatically colourizes code
' Written by James Crowley -
' www.vbweb.f9.co.uk
'----------------------------------------
Option Explicit
Private m_ColourComment As OLE_COLOR
Private m_ColourKeyword As OLE_COLOR
Private m_ColourText As OLE_COLOR
Private m_strBlackKeywords As String
Private m_strBlueKeywords As String
Private m_intSelPos As Integer
Private m_intSelLen As Integer
Private m_blnBusy As Boolean
Private m_blnChanged As Boolean
Private m_intNextLine As Integer
Private m_intLastLine As Integer
Private m_intLastLinePos As Integer
'Default Property Values:
Const m_def_AutoVerbMenu = 0
Const m_def_BulletIndent = 0
Const m_def_DisableNoScroll = 0
Const m_def_FileName = ""
Const m_def_Locked = 0
Const m_def_MultiLine = 0
Const m_def_OLEDragMode = 0
Const m_def_RightMargin = 0
Const m_def_ScrollBars = 0
Const m_def_Text = ""
Const m_def_ToolTipText = ""
Const m_def_ColourComment = 0
Const m_def_ColourKeyword = 0
Const m_def_ColourText = 0
'Property Variables:
Dim m_AutoVerbMenu As Boolean
Dim m_BulletIndent As Single
Dim m_DisableNoScroll As Boolean
Dim m_FileName As String
Dim m_Locked As Boolean
Dim m_MultiLine As Boolean
Dim m_OLEDragMode As OLEDragConstants
Dim m_RightMargin As Single
Dim m_ScrollBars As ScrollBarsConstants
Dim m_Text As String
Dim m_ToolTipText As String
Dim m_blnColour As Boolean
'Event Declarations:
Event Change()
Event Click()
Event DblClick()
Event OLECompleteDrag(Effect As Long)
Event OLEDragDrop(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Event OLEDragOver(Data As RichTextLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
Event OLESetData(Data As RichTextLib.DataObject, DataFormat As Integer)
Event OLEStartDrag(Data As RichTextLib.DataObject, AllowedEffects As Long)
Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyDown
Event KeyPress(KeyAscii As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyPress
Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyUp
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseDown
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseMove
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseUp
Event SelChange()
Public Property Get Font() As Font
Set Font = rtfMain.Font
End Property
Public Property Set Font(ByVal New_Font As Font)
Set rtfMain.Font = New_Font
Set rtfTemp.Font = New_Font
PropertyChanged "Font"
End Property
Public Property Get ColourComment() As OLE_COLOR
ColourComment = m_ColourComment
End Property
Public Property Let ColourComment(ByVal New_ColourComment As OLE_COLOR)
m_ColourComment = New_ColourComment
PropertyChanged "ColourComment"
End Property
Public Property Get ColourKeyword() As OLE_COLOR
ColourKeyword = m_ColourKeyword
End Property
Public Property Let ColourKeyword(ByVal New_ColourKeyword As OLE_COLOR)
m_ColourKeyword = New_ColourKeyword
PropertyChanged "ColourKeyword"
End Property
Public Property Get ColourText() As OLE_COLOR
ColourText = m_ColourText
End Property
Public Property Let ColourText(ByVal New_ColourText As OLE_COLOR)
m_ColourText = New_ColourText
PropertyChanged "ColourText"
End Property
Public Sub Initalize()
'// Initalize the words that need to be coloured
m_strBlackKeywords = "*Abs*Add*AddItem*AppActivate*Array*Asc*Atn*Beep*Begin*BeginProperty*ChDir*ChDrive*Choose*Chr*Clear*Collection*Command*Cos*CreateObject*CurDir*DateAdd*DateDiff*DatePart*DateSerial*DateValue*Day*DDB*DeleteSetting*Dir*DoEvents*EndProperty*Environ*EOF*Err*Exp*FileAttr*FileCopy*FileDateTime*FileLen*Fix*Format*FV*GetAllSettings*GetAttr*GetObject*GetSetting*Hex*Hide*Hour*InputBox*InStr*Int*Int*IPmt*IRR*IsArray*IsDate*IsEmpty*IsError*IsMissing*IsNull*IsNumeric*IsObject*Item*Kill*LCase*Left*Len*Load*Loc*LOF*Log*LTrim*Me*Mid*Minute*MIRR*MkDir*Month*Now*NPer*NPV*Oct*Pmt*PPmt*PV*QBColor*Raise*Randomize*Rate*Remove*RemoveItem*Reset*RGB*Right*RmDir*Rnd*RTrim*SaveSetting*Second*SendKeys*SetAttr*Sgn*Shell*Sin*Sin*SLN*Space*Sqr*Str*StrComp*StrConv*Switch*SYD*Tan*Text*Time*Time*Timer*TimeSerial*TimeValue*Trim*TypeName*UCase*Unload*Val*VarType*WeekDay*Width*Year*"
m_strBlueKeywords = "*#Const*#Else*#ElseIf*#End If*#If*Alias*Alias*And*As*Base*Binary*Boolean*Byte*ByVal*Call*Case*CBool*CByte*CCur*CDate*CDbl*CDec*CInt*CLng*Close*Compare*Const*CSng*CStr*Currency*CVar*CVErr*Decimal*Declare*DefBool*DefByte*DefCur*DefDate*DefDbl*DefDec*DefInt*DefLng*DefObj*DefSng*DefStr*DefVar*Dim*Do*Double*Each*Else*ElseIf*End*Enum*Eqv*Erase*Error*Exit*Explicit*False*For*Function*Get*Global*GoSub*GoTo*If*Imp*In*Input*Input*Integer*Is*LBound*Let*Lib*Like*Line*Lock*Long*Loop*LSet*Name*New*Next*Not*Object*On*Open*Option*Or*Output*Print*Private*Property*Public*Put*Random*Read*ReDim*Resume*Return*RSet*Seek*Select*Set*Single*Spc*Static*String*Stop*Sub*Tab*Then*Then*True*Type*UBound*Unlock*Variant*Wend*While*With*Xor*Nothing*To*"
End Sub
Public Sub Colour(rtf As Object, blnAll As Boolean)
Dim strText As String
Dim intSelLen As Long
If blnAll = True Then
'// If we want to colour the whole thing,
'// go to the end
rtfTemp.TextRTF = rtf.TextRTF
GoTo TheRest
End If
'// Copy the text into our tempory text box, colour it and
'// return the text to the original text box
strText = GetLineText(rtf)
If strText = "-1" Then
Exit Sub
End If
rtfTemp.Text = strText
TheRest:
'// Delete the line
If rtf.SelText Like "vbcrlf*" Then
intSelLen = rtf.SelLength
rtf.SelStart = rtf.SelStart + 2
rtf.SelLength = intSelLen - 2
ElseIf rtf.SelText Like "*vbcrlf" Then
rtf.SelLength = rtf.SelLength - 2
End If
rtf.SelText = ""
If rtfTemp.Text = "" Then